package com.amos.client.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * PROJECT: config-client
 * DESCRIPTION: note
 *
 * @author Daoyuan
 * @date 2019/2/28
 */
@RefreshScope
@Configuration
public class AppConfig {

    /**
     * 方式一
     */
    @Value("${APP_MESSAGE}")
    private String appFrom;
    @Value("${HELLO_MESSAGE}")
    private String helloMessage;

    public String getAppFrom() {
        return appFrom;
    }

    public String getHelloMessage() {
        return helloMessage;
    }

    /**
     * 方式二
     */
    private final Environment env;

    @Autowired
    public AppConfig(Environment env) {
        this.env = env;
    }

    public Environment getEnv() {
        return env;
    }
}
